<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
	<title>文档标题</title>
	<!-- 优先使用 IE 最新版本和 Chrome -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	
	<!-- 开启响应式 -->
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
	
	<!-- SEO页面关键词 -->
	<meta name="keywords" content="your keywords" />
	
	<!-- SEO页面描述 -->
	<meta name="description" content="your description" />
	
	<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">
</head>
<body>
	<form action="#">
		<input type="text" name="sum1">
		<input type="text" name="sum2">
		<input type="button" value="result" id="sum">
	</form>
	<div id="result"></div>
	<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
	<script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
	<script>
		$(document).ready(function(){
			$("#sum").on("click",function(){
				var param = "sum1=" + $("input[name='sum1']").val() + "&sum2=" + $("input[name='sum2']").val();
				console.log(param);
				Ajax(param);
			});
		});
		var Ajax = function(param){
			$.ajax({type: "POST",async: true,url: "sum",dataType: "text",data: param,
				success: function(data){
					$("#result").text(data);
				},
				beforeSend: function(XMLHttpRequest){
					console.log("发送请求...");
				}
			});
		}
	</script>
</body>
</html>